import React from 'react';
import { Select, Input, Form, Button } from 'antd';
import styles from './index.less';
import useHireReject from './hooks/useHireReject';

const ConfirmReject = ({ form, setStatus, location }) => {
    const { query } = location;
    const { employId } = query;
    const { getFieldDecorator } = form;
    const { optionList, submitLoading, handleSubmit } = useHireReject({ form, setStatus, employId });
    return (
        <div className={styles.confirmRejectContent}>
            <div className={styles.outerBox}>
                <div className={styles.pleaseInputReason}>请反馈拒绝录用理由：</div>
                <div className={styles.formWrap}>
                    <Form layout="horizontal" labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
                        <Form.Item required label="原因">
                            {getFieldDecorator('terminationType', {
                                rules: [{ required: true, message: '请选择原因' }]
                            })(
                                <Select placeholder="请选择">
                                    {optionList.map(item => (
                                        <Select.Option key={item.value} label={item.label}>
                                            {item.label}
                                        </Select.Option>
                                    ))}
                                </Select>
                            )}
                        </Form.Item>
                        <Form.Item label="备注">
                            {getFieldDecorator(
                                'remark',
                                {}
                            )(<Input.TextArea placeholder="请输入" rows={3} maxLength={200}></Input.TextArea>)}
                        </Form.Item>
                    </Form>
                </div>
                <div style={{ textAlign: 'center' }}>
                    <Button loading={submitLoading} type="primary" onClick={handleSubmit}>
                        提交
                    </Button>
                </div>
            </div>
        </div>
    );
};

export default Form.create()(ConfirmReject);
